{{#partial title}}登录 - Rust China{{/partial}}
{{#partial page}}
  <div class="container">
    <div class="row">
      <div class="col-md-9">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">登录</h3>
          </div>
          <div class="panel-body">
            <form class="form-horizontal" method="post" action="/user/login" id="loginForm">
              <div class="form-group">
                <label for="inputUsername" class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" id="inputUsername" name="username" placeholder="用户名">
                </div>
              </div>

              <div class="form-group">
                <label for="inputPassword" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-4">
                  <input type="password" class="form-control" id="inputPassword" name="password" placeholder="密码">
                </div>
              </div>

              <div class="form-group hidden" id="error">
                  <div class="col-sm-offset-2 col-sm-4 text-danger"></div>
              </div>

              <div class="form-group">
                  <div class="col-sm-offset-2 col-sm-4">

                      <div class="checkbox">
                          <label>
                              <input type="checkbox" name="persist" value="1">
                              记住登录状态
                          </label>
                      </div>
                  </div>
              </div>

              <div class="form-group">
                <div class="col-sm-offset-2 col-sm-4">
                  <button type="submit" class="btn btn-default">登录</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
{{/partial}}
{{#partial footer_js}}
  <script>
   $('#loginForm').ajaxForm({
       success: function(data) {
           if (data.status != 0) {
               $('#error div').text(data.message);
               $('#error').removeClass('hidden').addClass('show');
           } else {
               location.href = "/";
           }
       }
   });
  </script>
{{/partial}}
{{~> base~}}
